package com.wsh.archive.service.command;

import java.util.Map;

import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;

import com.wsh.archive.service.business.ArchiveService;
import com.wsh.archive.service.constants.ArchiveConstants;
import com.wsh.archive.service.facade.BeanFacade;
import com.wsh.archive.vo.ArchiveVO;

public class LerArquivoCMD implements Command {

	@Override
	public boolean execute(Context ctx) throws Exception {
		
		ArchiveVO vo = (ArchiveVO) ctx.get(ArchiveConstants.ARCHIVE_VO);
		ArchiveService service = BeanFacade.getInstance().getBean(vo.getTypeArchiveKey());
		Map<Integer, String> result = service.read(vo);
		ctx.put(ArchiveConstants.ARCHIVE_MAP, result);		
		
		return false;
	}

}
